<!--
  @author duanzuocai
  @since 2018/10/30 13:57
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head th:include="common/common :: jscss">
    <title>新增或编辑分类</title>
</head>
<body>

<div class="layui-fluid">

    <blockquote class="layui-elem-quote layui-text">
        <zmn th:text="${(area.areaId == 0) ? '新增区域' : '修改'+area.name}"></zmn>
    </blockquote>

    <div class="layui-card">
        <form method="post" action="" class="layui-form" lay-filter="zmn-area-form">

            <input type="hidden" name="areaId" th:value="${area.areaId}"/>
            <input type="hidden" name="parentId" th:value="${area.parentId}"/>

            <div class="layui-card-header" style="margin-top:10px;"><b>基本信息</b></div>
            <div class="layui-split">&nbsp;</div>

            <div class="layui-form-item">
                <label class="layui-form-label">上级区域</label>
                <div class="layui-input-block">
                    <div class="layui-form-mid layui-word-aux">
                        <span th:text="${parent.name}"></span>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">区域层级</label>
                <div class="layui-form-mid layui-word-aux">
                    <s0..pan th:text="${parent.level + 1}"></s0..pan>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">区域名称</label>
                <div class="layui-input-inline" style="width:400px;">
                    <input type="text" name="name" lay-verify="required" th:value="${area.name}" autocomplete="off"
                           class="layui-input" maxlength="32"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">区域代码</label>
                <div class="layui-input-inline" style="width:240px;">
                    <input type="text" name="code" lay-verify="required" th:value="${area.code}" autocomplete="off"
                           class="layui-input" maxlength="32"/>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">区号</label>
                <div class="layui-input-inline" style="width:240px;">
                    <input type="text" name="areaNum" lay-verify="required" th:value="${area.areaNum}" autocomplete="off"
                           class="layui-input" maxlength="32"/>
                </div>
            </div>

           <!-- <div class="layui-form-item" th:if="${parent.level  == 2}">
                <label class="layui-form-label layui-form-required">城市类型</label>
                <div class="layui-input-inline" style="width:240px;">
                    <select name="type" id="type" lay-filter="type" lay-verify="required">
                        <option th:selected="${area.type == 1}" value="1">标准城市</option>
                        <option th:selected="${area.type == 2}" value="2">虚拟城市</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item" id="mid_div">
                <label class="layui-form-label layui-form-required">管理城市</label>
                <div class="layui-input-inline" style="width:240px;">
                    <select name="mid" id="mid" lay-filter="mid" lay-verify="" lay-search>
                        <option value="">请选择</option>
                        <option th:each="city:${citys}" th:value="${city.areaId}" th:text="${city.name}"
                                th:selected="${city.areaId == area.mid}"></option>
                    </select>
                </div>
            </div>-->


            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">经度</label>
                <div class="layui-input-inline" style="width:240px;">
                    <input type="text" name="longitude" lay-verify="checkLong|required" th:value="${area.longitude}"
                           autocomplete="off" class="layui-input" maxlength="10"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">纬度</label>
                <div class="layui-input-inline" style="width:240px;">
                    <input type="text" name="latitude" lay-verify="checkLat|required" th:value="${area.latitude}"
                           autocomplete="off" class="layui-input" maxlength="10"/>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">排序</label>
                <div class="layui-input-inline" style="width:240px;">
                    <input type="number" name="sort" autocomplete="off" class="layui-input" th:value="${area.sort}"
                           lay-verify="isPositiveNumber|required">
                </div>
            </div>

            <zmn th:if="${area.areaId > 0}">
                <div class="layui-card-header"><b>其他信息</b></div>
                <div class="layui-split">&nbsp;</div>
                <div class="layui-form-item layui-form-item-xs">
                    <label class="layui-form-label">修改人/时间</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux"
                             th:text="${area.updater} + '&nbsp;/&nbsp;' + ${#dates.format(area.updateTime, 'yyyy-MM-dd HH:mm:ss')}">
                            修改人/时间
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-form-item-xs">
                    <label class="layui-form-label">创建人/时间</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux"
                             th:text="${area.creater} + '&nbsp;/&nbsp;' + ${#dates.format(area.createTime, 'yyyy-MM-dd HH:mm:ss')}">
                            创建人/时间
                        </div>
                    </div>
                </div>
            </zmn>

            <div class="layui-split">&nbsp;</div>
            <div class="layui-form-item layui-layout-admin">
                <div class="layui-input-block">
                    <div class="layui-footer" style="left: 0;">
                        <button class="layui-btn" lay-submit="" lay-filter="zmn-area-form-submit" th:if="${#authPermit.checkPermit('/area/detail.action')}">保存</button>
                        <button class="layui-btn layui-btn-primary" id="cancleBtn">
                            取消
                        </button>
                    </div>
                </div>
            </div>

        </form>

    </div>

</div>

<script type="text/javascript" th:inline="javascript">

    var json = {
        area: [[${area}]]
    };

    layui.config({
        base: "/static/lay/"
    }).extend({
        index: "lib/index",
        art_area_detail: "area/zmn.art.area.edit",
    }).use(['index', 'art_area_detail']);

</script>
</body>
</html>